package com.easipass.framework.eirframeworkbeanshell;

import org.springframework.scripting.bsh.BshScriptUtils;

public class ScriptHandle {
    public void process(String srciptText, Message message){
        Script script;
        try {
            script = (Script) BshScriptUtils.createBshObject(srciptText, new Class[] { Script.class});
            script.process(message);
        } catch (bsh.EvalError evalError) {
            evalError.printStackTrace();
        }
    }
    public Object process(String srciptText, Object object){
        Script script;
        Object obj = null;
        try {
            script = (Script) BshScriptUtils.createBshObject(srciptText, new Class[] { Script.class});
            obj = script.process(object);
        } catch (bsh.EvalError evalError) {
            evalError.printStackTrace();
        }
        return obj;
    }
}
